# -*- coding UTF-8 -*-
import unittest

from game_config import GameConfig
from presenter_mock import PresenterMock
from model import gamestate


class GameConfigTest(unittest.TestCase):
    def setUp(self):
        settings = gamestate.Settings(0, 0)
        self.gamestate = gamestate.GameState(0, 0, 0, 0, 0, None, settings)
        self.presenter = PresenterMock(gamestate.Phase.START_GAME)

    def test_button_pressed(self):
        widget = GameConfig(self.gamestate, self.presenter)
        self.assertEquals(self.presenter.is_phase_changed, False)
        self.assertEquals(self.gamestate.settings.time_per_round_sec, 0)
        self.assertEquals(self.gamestate.settings.words_number, 0)
        widget.change_time(20)
        widget.change_words_count(30)
        widget.next_view()
        self.assertEquals(self.presenter.is_phase_changed, True)
        self.assertEquals(self.gamestate.settings.time_per_round_sec, 20)
        self.assertEquals(self.gamestate.settings.words_number, 30)


if __name__ == '__main__':
    unittest.main()
